#include <arch/x86/machine.h>
#include <systm.h>

#define KSTACKSIZE	4096

/* This is x86-specific, should be done in another way */

/*
struct proc {
	struct trapframe context;
	int state;
	struct proc *next;
};

struct proc *allproc;

void
spawn_kthread( (void)(*f)(void) )
{
	struct proc *lastproc = allproc;
	
	struct proc *newproc = (struct proc *) malloc(sizeof(proc));
	
	newproc->context.eip = (uint) f;
	newproc->context._esp = (uint) malloc (KSTACKSIZE);
	newproc->next = NULL;
	
	while (lastproc->next)
		lastproc = lastproc->next;
	
	lastproc->next = newproc;
}

char kstack1[KSTACKSIZE], kstack2[KSTACKSIZE];

void kthread_one(void)
{
	volatile uint k;
	while (1)
	{
		k = 0xffffff;
		printf("Thread 1\n");
		while (k--)
			;
	}
}

void kthread_two(void)
{
	volatile uint k;
	while (1)
	{
		k = 0xffffff;
		printf("Thread 2\n");
		while (k--)
			;
	}
}

*/
